<?php

class Application_Form_Login extends Zend_Form {

    public function init() {
        $this->setAction('/default/auth/login')
                ->setMethod('post')
                ->setAttrib('id', 'loginForm')
                ->setDecorators(ZendBlog_Decorator_Decorator::Form());

        /* Username */
        $this->addElement('text', 'name', array(
            'decorators' => ZendBlog_Decorator_Decorator::Element(),
            'label' => 'Username',
            'validators' => array('alnum'),
            'filter' => 'StringTrim',
            'required' => true
        ));

        /* Password */
        $this->addElement('password', 'password', array(
            'decorators' => ZendBlog_Decorator_Decorator::Element(),
            'label' => 'Password',
            'validators' => array(
                array('stringLength', true, array(4))
            ),
            'filter' => 'StringTrim',
            'required' => true
        ));
        
        /* Login button */
        $this->addElement('submit', 'Login', array(
            'decorators' => ZendBlog_Decorator_Decorator::Submit()
        ));
    }
}

